package com.xty.forum.controller;

import com.xty.forum.common.AppResult;
import com.xty.forum.exception.ApplicationException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description TODO
 * @ClassName TestController
 * @Author RUHUA
 * @Data 2025/11/6 16:13
 */

@RestController
@RequestMapping("/test")
public class TestController {
    @RequestMapping("/hello")
    public String hello() {
        return "基于Spring的论坛系统...";
    }

    @GetMapping("/exception")
    public AppResult testException() throws Exception {
        throw new Exception("这是一个exception...");
    }
    @GetMapping("/appException")
    public AppResult testAppException() {
        throw new ApplicationException("这是一个appException...");
    }
}
